Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended magnetic mapping #222

Closed
wants to merge 8 commits into from
Closed

Conversation

AreWeDreaming
Copy link
Collaborator

  • This my crude attempt to allow mapping between rho_pol_norm <-> rho_tor_norm
  • This also includes phi
  • I qualitatively tested rho_pol_norm -> rho_tor_norm
  • Might have some COCOS issues
  • Probably overly complicated
  • Needs dynamic fetching of phi and rho_pol_norm

- This my crude attempt to allow mapping between
rho_pol_norm <-> rho_tor_norm
- This also includes phi
- I qualitatively tested rho_pol_norm -> rho_tor_norm
- Might have some COCOS issues
- Probably overly complicated
- Needs dynamic fetching of `phi` and `rho_pol_norm`
@smithsp
Copy link
Member

smithsp commented Dec 5, 2022

I see this PR is labeled as WIP, so ignoring for now.

- Tested against mapping form OMFITprofiles
- Results are OK by eye. Numerical verification still pending.
from scipy.interpolate import InterpolatedUnivariateSpline
psi_grid = ods["equilibrium"]["time_slice"][time_index]["profiles_1d"]["psi"]
psi_mask = mask_SOL(ods, time_index, psi_grid)
phi_grid = ods["equilibrium"]["time_slice"][time_index]["profiles_1d"]["psi"][psi_mask]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a bug using this definition, phi_grid = psi_grid[psi_mask]

+ ods["equilibrium"]["time_slice"][time_index]["global_quantities"]["psi_axis"])
elif origin == "rho_tor_norm":
phi = values**2
phi *= np.array([ods["equilibrium"]["time_slice"][time_index]["global_quantities"]["psi_boundary"]]) / np.max(phi)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phi is normalized or real poloidal flux? Because you should multiply it by phi_boundary not by psi_boundary
also, why are you normalizing it by np.max(phi)? What it somebody use as values rho_tor = 0.5? It will force it to be one, always.

psi_spl = InterpolatedUnivariateSpline(phi_grid, psi_grid[psi_mask])
phi_min = np.min(phi_grid)
phi_max = np.max(phi_grid)
values_mask = np.logical_ant(values > phi_min, values < phi_max)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np.logical_ant(values > phi_min, values < phi_max) is the same as (values > phi_min)&(values < phi_max)

Copy link
Collaborator Author

@AreWeDreaming AreWeDreaming Feb 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I literally put a bug in this line xD (a logical ant to be specific)

@github-actions
Copy link

Stale pull request message

@AreWeDreaming AreWeDreaming reopened this Oct 21, 2023
@AreWeDreaming AreWeDreaming changed the title WIP: Extended magnetic mapping Extended magnetic mapping Oct 21, 2023
@github-actions github-actions bot closed this Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants